* Rep_Time dependent censoring.sps.
* Written by PSKL on 19/09/02.

Get file='D:\Longitudinal Data\Rep_Claims Master 1991 to 2001.sav'.


* Create year/month variable and schednum to number of months.
* Then calculate observation interval in months to next schednum if revisit or 10203 if not.

Compute lstmsn=(lastyear-1900)*100 + lastmont.
Compute schedym=trunc(schednum/100)*12 + schednum - 100*trunc(schednum/100).
Compute lastym = (lastyear-1900)*12 + lastmont.


sort cases by patidn (a) schednum lastym (d).

compute revisit = 0.
if (patidn=lag(patidn)) revisit = 1.

compute  interval = 12*102+3 - lastym.
if (patidn=lag(patidn))interval = lag(schedym) - lastym.

formats patidn claimidn (F10) lstmsn interval (F6) revisit (F1).

save outfile='d:\temp1.sav'
/keep patidn claimidn lstmsn schednum interval revisit fpcnum exempbox.

get file='d:\temp1.sav'.

CROSSTABS
  /TABLES=interval  BY revisit
  /FORMAT= AVALUE TABLES
  /CELLS= COUNT .

Crosstabs

Notes
Output Created 28-MAY-2003 10:05:47
Comments
Input Data d:\temp1.sav
Filter <none>
Weight <none>
Split File <none>
N of Rows in Working Data File 710052
Missing Value Handling Definition of Missing User-defined missing values are treated as missing.
Cases Used Statistics for each table are based on all the cases with valid data in the specified range(s) for all variables in each table.
Syntax CROSSTABS
/TABLES=interval BY revisit
/FORMAT= AVALUE TABLES
/CELLS= COUNT .
Resources Dimensions Requested 2
Cells Available 116508
Elapsed Time 0:00:05.84

Case Processing Summary

Cases
Valid Missing Total
N Percent N Percent N Percent
INTERVAL * REVISIT 710052 100.0% 0 .0% 710052 100.0%


INTERVAL * REVISIT Crosstabulation
Count

REVISIT Total
0 1
INTERVAL 0 961 1015 1976
1 3990 15103 19093
2 4895 32931 37826
3 3586 37396 40982
4 4614 42007 46621
5 4359 36984 41343
6 3521 47697 51218
7 2606 106248 108854
8 2150 79930 82080
9 1848 47691 49539
10 1591 31446 33037
11 1190 21412 22602
12 1316 17081 18397
13 1000 14737 15737
14 1061 12118 13179
15 733 9756 10489
16 874 8155 9029
17 785 6602 7387
18 755 5562 6317
19 650 4807 5457
20 659 4212 4871
21 647 3663 4310
22 626 3308 3934
23 510 3026 3536
24 638 2826 3464
25 590 2501 3091
26 507 2285 2792
27 458 2022 2480
28 529 1676 2205
29 488 1652 2140
30 498 1440 1938
31 411 1350 1761
32 465 1220 1685
33 464 1077 1541
34 397 1056 1453
35 439 1004 1443
36 489 898 1387
37 387 824 1211
38 380 819 1199
39 335 711 1046
40 439 677 1116
41 422 639 1061
42 439 632 1071
43 357 562 919
44 431 569 1000
45 398 473 871
46 360 460 820
47 387 456 843
48 404 393 797
49 375 441 816
50 383 391 774
51 321 373 694
52 327 352 679
53 368 348 716
54 351 315 666
55 287 283 570
56 359 283 642
57 334 255 589
58 322 291 613
59 311 282 593
60 324 257 581
61 317 257 574
62 342 258 600
63 280 196 476
64 322 205 527
65 323 188 511
66 333 169 502
67 292 166 458
68 365 167 532
69 324 167 491
70 324 157 481
71 325 147 472
72 338 126 464
73 322 135 457
74 295 142 437
75 245 129 374
76 359 119 478
77 323 123 446
78 329 120 449
79 290 110 400
80 312 111 423
81 315 105 420
82 328 88 416
83 267 93 360
84 335 65 400
85 313 104 417
86 299 73 372
87 245 77 322
88 273 62 335
89 294 74 368
90 306 68 374
91 288 69 357
92 272 54 326
93 268 55 323
94 261 45 306
95 266 55 321
96 315 54 369
97 259 38 297
98 263 38 301
99 225 54 279
100 251 50 301
101 251 38 289
102 285 33 318
103 251 45 296
104 278 26 304
105 294 40 334
106 247 28 275
107 282 24 306
108 309 28 337
109 252 21 273
110 285 17 302
111 248 20 268
112 311 19 330
113 282 26 308
114 285 20 305
115 214 22 236
116 292 18 310
117 222 12 234
118 220 12 232
119 250 7 257
120 234 11 245
121 234 12 246
122 198 11 209
123 172 7 179
124 201 3 204
125 227 7 234
126 212 7 219
127 156 8 164
128 178 3 181
129 158 1 159
130 176 2 178
131 200 2 202
132 191 3 194
133 157
157
134 170
170
Total 80026 630026 710052

* Create look-up file of probability of reattendance.

Aggregate outfile=*
 /break interval revisit
 /n=n.

sort cases by interval revisit (d).
compute cases=n.
if (revisit=0 and lag(interval)=interval) cases=n+lag(n).
execute.
select if revisit=0.
compute reattend=cases-n.

compute cumcases=cases.
compute cumreatt=reattend.

do if ($casenum > 1).
compute cumcases=cumcases+lag(cumcases).
compute cumreatt=cumreatt + lag(cumreatt).
end if.

compute prreatt=cumreatt/cumcases.
sort cases by interval.

save outfile='D:\Longitudinal Data\Rep_reattendance probability.sav'
  /DROP=revisit n cases reattend cumcases cumreatt /COMPRESSED.

*****************************************************************************************.

* Repeat analysis contrasting between London and elsewhere.

get file='d:\temp1.sav'.
sort cases by FPCNUM.
Match files file=*
 /table='d:\longitudinal data\London FPCNUMS.sav'
 /by FPCNUM.
Compute London=0.
If (n>0) London=1.

save outfile='d:\temp2.sav'.

CROSSTABS
  /TABLES=interval  BY revisit By LONDON
  /FORMAT= AVALUE TABLES
  /CELLS= COUNT .

Crosstabs

Notes
Output Created 28-MAY-2003 10:07:03
Comments
Input Data d:\temp2.sav
Filter <none>
Weight <none>
Split File <none>
N of Rows in Working Data File 710052
Missing Value Handling Definition of Missing User-defined missing values are treated as missing.
Cases Used Statistics for each table are based on all the cases with valid data in the specified range(s) for all variables in each table.
Syntax CROSSTABS
/TABLES=interval BY revisit By LONDON
/FORMAT= AVALUE TABLES
/CELLS= COUNT .
Resources Dimensions Requested 3
Cells Available 95325
Elapsed Time 0:00:06.65

Case Processing Summary

Cases
Valid Missing Total
N Percent N Percent N Percent
INTERVAL * REVISIT * LONDON 710052 100.0% 0 .0% 710052 100.0%


INTERVAL * REVISIT * LONDON Crosstabulation
Count

REVISIT Total
LONDON 0 1
.00 INTERVAL 0 911 994 1905
1 3511 13598 17109
2 4330 28584 32914
3 3173 32621 35794
4 4029 36840 40869
5 3785 32337 36122
6 3051 42720 45771
7 2220 94490 96710
8 1849 69843 71692
9 1536 41047 42583
10 1329 26932 28261
11 973 18066 19039
12 1085 14340 15425
13 799 12272 13071
14 870 9995 10865
15 595 8048 8643
16 692 6653 7345
17 634 5373 6007
18 589 4549 5138
19 517 3910 4427
20 535 3419 3954
21 499 2919 3418
22 475 2610 3085
23 406 2397 2803
24 501 2251 2752
25 441 1993 2434
26 382 1837 2219
27 352 1632 1984
28 426 1340 1766
29 376 1304 1680
30 395 1131 1526
31 314 1049 1363
32 360 959 1319
33 335 845 1180
34 302 829 1131
35 345 781 1126
36 381 706 1087
37 296 627 923
38 307 641 948
39 257 566 823
40 335 511 846
41 336 492 828
42 337 501 838
43 280 466 746
44 340 442 782
45 317 374 691
46 278 359 637
47 293 343 636
48 309 324 633
49 292 350 642
50 299 297 596
51 252 298 550
52 272 278 550
53 289 277 566
54 268 253 521
55 217 213 430
56 271 217 488
57 254 200 454
58 247 223 470
59 238 212 450
60 244 201 445
61 245 192 437
62 261 210 471
63 215 151 366
64 247 168 415
65 264 142 406
66 256 140 396
67 227 132 359
68 285 134 419
69 248 135 383
70 249 126 375
71 252 119 371
72 266 99 365
73 246 113 359
74 230 112 342
75 199 99 298
76 281 88 369
77 247 91 338
78 248 95 343
79 232 85 317
80 241 88 329
81 252 81 333
82 254 72 326
83 218 71 289
84 251 49 300
85 263 87 350
86 249 58 307
87 182 66 248
88 208 47 255
89 225 60 285
90 247 53 300
91 219 53 272
92 198 43 241
93 209 44 253
94 209 35 244
95 210 44 254
96 240 41 281
97 199 33 232
98 210 32 242
99 168 39 207
100 194 43 237
101 186 33 219
102 225 30 255
103 189 32 221
104 208 21 229
105 239 26 265
106 192 25 217
107 230 22 252
108 230 24 254
109 201 18 219
110 233 14 247
111 201 17 218
112 254 15 269
113 218 21 239
114 223 16 239
115 173 18 191
116 210 13 223
117 188 11 199
118 166 11 177
119 189 6 195
120 169 7 176
121 187 9 196
122 153 8 161
123 136 5 141
124 152 3 155
125 173 7 180
126 166 5 171
127 102 6 108
128 136 3 139
129 117 1 118
130 132 1 133
131 148
148
132 149 2 151
133 119
119
134 123
123
Total 65592 543879 609471
1.00 INTERVAL 0 50 21 71
1 479 1505 1984
2 565 4347 4912
3 413 4775 5188
4 585 5167 5752
5 574 4647 5221
6 470 4977 5447
7 386 11758 12144
8 301 10087 10388
9 312 6644 6956
10 262 4514 4776
11 217 3346 3563
12 231 2741 2972
13 201 2465 2666
14 191 2123 2314
15 138 1708 1846
16 182 1502 1684
17 151 1229 1380
18 166 1013 1179
19 133 897 1030
20 124 793 917
21 148 744 892
22 151 698 849
23 104 629 733
24 137 575 712
25 149 508 657
26 125 448 573
27 106 390 496
28 103 336 439
29 112 348 460
30 103 309 412
31 97 301 398
32 105 261 366
33 129 232 361
34 95 227 322
35 94 223 317
36 108 192 300
37 91 197 288
38 73 178 251
39 78 145 223
40 104 166 270
41 86 147 233
42 102 131 233
43 77 96 173
44 91 127 218
45 81 99 180
46 82 101 183
47 94 113 207
48 95 69 164
49 83 91 174
50 84 94 178
51 69 75 144
52 55 74 129
53 79 71 150
54 83 62 145
55 70 70 140
56 88 66 154
57 80 55 135
58 75 68 143
59 73 70 143
60 80 56 136
61 72 65 137
62 81 48 129
63 65 45 110
64 75 37 112
65 59 46 105
66 77 29 106
67 65 34 99
68 80 33 113
69 76 32 108
70 75 31 106
71 73 28 101
72 72 27 99
73 76 22 98
74 65 30 95
75 46 30 76
76 78 31 109
77 76 32 108
78 81 25 106
79 58 25 83
80 71 23 94
81 63 24 87
82 74 16 90
83 49 22 71
84 84 16 100
85 50 17 67
86 50 15 65
87 63 11 74
88 65 15 80
89 69 14 83
90 59 15 74
91 69 16 85
92 74 11 85
93 59 11 70
94 52 10 62
95 56 11 67
96 75 13 88
97 60 5 65
98 53 6 59
99 57 15 72
100 57 7 64
101 65 5 70
102 60 3 63
103 62 13 75
104 70 5 75
105 55 14 69
106 55 3 58
107 52 2 54
108 79 4 83
109 51 3 54
110 52 3 55
111 47 3 50
112 57 4 61
113 64 5 69
114 62 4 66
115 41 4 45
116 82 5 87
117 34 1 35
118 54 1 55
119 61 1 62
120 65 4 69
121 47 3 50
122 45 3 48
123 36 2 38
124 49
49
125 54
54
126 46 2 48
127 54 2 56
128 42
42
129 41
41
130 44 1 45
131 52 2 54
132 42 1 43
133 38
38
134 47
47
Total 14434 86147 100581

get file='d:\temp2.sav'.

Aggregate outfile=*
 /break interval revisit London
 /n=n.

sort cases by London (a) interval revisit (d).
compute cases=n.
if (revisit=0 and lag(London)=London and lag(interval)=interval) cases=n+lag(n).
execute.
select if revisit=0.
compute reattend=cases-n.

compute cumcases=cases.
compute cumreatt=reattend.

do if ($casenum > 1 and Lag (London) = London).
compute cumcases=cumcases+lag(cumcases).
compute cumreatt=cumreatt + lag(cumreatt).
end if.

compute prreatt=cumreatt/cumcases.
sort cases by London interval.

save outfile='D:\Longitudinal Data\Rep_reattendance probability London.sav'
  /DROP=revisit n cases reattend cumcases cumreatt /COMPRESSED.

*******************************************************************************************.

* Repeat the exercise for paying vs exempt.

get file='d:\temp1.sav'.

Compute Fullpay=1.
If (exempbox ne ' ') Fullpay=0.

CROSSTABS
  /TABLES=interval  BY revisit By Fullpay
  /FORMAT= AVALUE TABLES
  /CELLS= COUNT .

Crosstabs

Notes
Output Created 28-MAY-2003 10:07:14
Comments
Input Data d:\temp1.sav
Filter <none>
Weight <none>
Split File <none>
N of Rows in Working Data File 710052
Missing Value Handling Definition of Missing User-defined missing values are treated as missing.
Cases Used Statistics for each table are based on all the cases with valid data in the specified range(s) for all variables in each table.
Syntax CROSSTABS
/TABLES=interval BY revisit By Fullpay
/FORMAT= AVALUE TABLES
/CELLS= COUNT .
Resources Dimensions Requested 3
Cells Available 95325
Elapsed Time 0:00:21.12

Case Processing Summary

Cases
Valid Missing Total
N Percent N Percent N Percent
INTERVAL * REVISIT * FULLPAY 710052 100.0% 0 .0% 710052 100.0%


INTERVAL * REVISIT * FULLPAY Crosstabulation
Count

REVISIT Total
FULLPAY 0 1
.00 INTERVAL 0 201 337 538
1 871 4373 5244
2 1002 9006 10008
3 730 10030 10760
4 981 11121 12102
5 871 9660 10531
6 746 11371 12117
7 622 19289 19911
8 545 15070 15615
9 480 9893 10373
10 416 6898 7314
11 355 5076 5431
12 357 4132 4489
13 307 3535 3842
14 341 2918 3259
15 207 2421 2628
16 250 2178 2428
17 237 1792 2029
18 255 1563 1818
19 207 1272 1479
20 217 1182 1399
21 223 1116 1339
22 216 1024 1240
23 157 904 1061
24 218 843 1061
25 200 764 964
26 168 709 877
27 147 654 801
28 170 536 706
29 166 516 682
30 164 486 650
31 139 451 590
32 158 420 578
33 150 385 535
34 139 345 484
35 151 342 493
36 169 319 488
37 125 267 392
38 115 274 389
39 121 255 376
40 137 233 370
41 140 204 344
42 159 200 359
43 119 195 314
44 133 190 323
45 118 166 284
46 118 168 286
47 126 170 296
48 126 134 260
49 124 146 270
50 130 130 260
51 93 133 226
52 91 122 213
53 114 132 246
54 106 113 219
55 90 103 193
56 110 88 198
57 118 88 206
58 111 84 195
59 113 101 214
60 115 96 211
61 105 92 197
62 106 82 188
63 91 72 163
64 102 79 181
65 115 65 180
66 109 48 157
67 94 50 144
68 96 46 142
69 108 50 158
70 101 60 161
71 115 42 157
72 111 38 149
73 103 44 147
74 95 43 138
75 66 44 110
76 110 42 152
77 97 37 134
78 106 34 140
79 91 43 134
80 87 33 120
81 96 35 131
82 93 28 121
83 87 25 112
84 97 19 116
85 95 28 123
86 85 21 106
87 72 25 97
88 82 17 99
89 95 21 116
90 104 24 128
91 95 28 123
92 77 18 95
93 84 11 95
94 89 16 105
95 74 19 93
96 89 19 108
97 82 16 98
98 85 13 98
99 61 14 75
100 74 11 85
101 76 10 86
102 84 6 90
103 65 18 83
104 79 5 84
105 75 10 85
106 71 10 81
107 79 7 86
108 87 8 95
109 48 10 58
110 58 5 63
111 54 4 58
112 76 3 79
113 66 6 72
114 76 6 82
115 55 6 61
116 75 6 81
117 59 1 60
118 57 6 63
119 75 2 77
120 67 5 72
121 69 1 70
122 48 3 51
123 42 1 43
124 47 1 48
125 62
62
126 62 2 64
127 40 4 44
128 60 1 61
129 42 1 43
130 47
47
131 45
45
132 49 1 50
133 34
34
134 38
38
Total 21576 148324 169900
1.00 INTERVAL 0 760 678 1438
1 3119 10730 13849
2 3893 23925 27818
3 2856 27366 30222
4 3633 30886 34519
5 3488 27324 30812
6 2775 36326 39101
7 1984 86959 88943
8 1605 64860 66465
9 1368 37798 39166
10 1175 24548 25723
11 835 16336 17171
12 959 12949 13908
13 693 11202 11895
14 720 9200 9920
15 526 7335 7861
16 624 5977 6601
17 548 4810 5358
18 500 3999 4499
19 443 3535 3978
20 442 3030 3472
21 424 2547 2971
22 410 2284 2694
23 353 2122 2475
24 420 1983 2403
25 390 1737 2127
26 339 1576 1915
27 311 1368 1679
28 359 1140 1499
29 322 1136 1458
30 334 954 1288
31 272 899 1171
32 307 800 1107
33 314 692 1006
34 258 711 969
35 288 662 950
36 320 579 899
37 262 557 819
38 265 545 810
39 214 456 670
40 302 444 746
41 282 435 717
42 280 432 712
43 238 367 605
44 298 379 677
45 280 307 587
46 242 292 534
47 261 286 547
48 278 259 537
49 251 295 546
50 253 261 514
51 228 240 468
52 236 230 466
53 254 216 470
54 245 202 447
55 197 180 377
56 249 195 444
57 216 167 383
58 211 207 418
59 198 181 379
60 209 161 370
61 212 165 377
62 236 176 412
63 189 124 313
64 220 126 346
65 208 123 331
66 224 121 345
67 198 116 314
68 269 121 390
69 216 117 333
70 223 97 320
71 210 105 315
72 227 88 315
73 219 91 310
74 200 99 299
75 179 85 264
76 249 77 326
77 226 86 312
78 223 86 309
79 199 67 266
80 225 78 303
81 219 70 289
82 235 60 295
83 180 68 248
84 238 46 284
85 218 76 294
86 214 52 266
87 173 52 225
88 191 45 236
89 199 53 252
90 202 44 246
91 193 41 234
92 195 36 231
93 184 44 228
94 172 29 201
95 192 36 228
96 226 35 261
97 177 22 199
98 178 25 203
99 164 40 204
100 177 39 216
101 175 28 203
102 201 27 228
103 186 27 213
104 199 21 220
105 219 30 249
106 176 18 194
107 203 17 220
108 222 20 242
109 204 11 215
110 227 12 239
111 194 16 210
112 235 16 251
113 216 20 236
114 209 14 223
115 159 16 175
116 217 12 229
117 163 11 174
118 163 6 169
119 175 5 180
120 167 6 173
121 165 11 176
122 150 8 158
123 130 6 136
124 154 2 156
125 165 7 172
126 150 5 155
127 116 4 120
128 118 2 120
129 116
116
130 129 2 131
131 155 2 157
132 142 2 144
133 123
123
134 132
132
Total 58450 481702 540152

Aggregate outfile=*
 /break interval revisit Fullpay
 /n=n.

sort cases by Fullpay (a) interval revisit (d).
compute cases=n.
if (revisit=0 and lag(Fullpay)=Fullpay and lag(interval)=interval) cases=n+lag(n).
execute.
select if revisit=0.
compute reattend=cases-n.

compute cumcases=cases.
compute cumreatt=reattend.

do if ($casenum > 1 and Lag (Fullpay) = Fullpay).
compute cumcases=cumcases+lag(cumcases).
compute cumreatt=cumreatt + lag(cumreatt).
end if.

compute prreatt=cumreatt/cumcases.
sort cases by Fullpay interval.

save outfile='D:\Longitudinal Data\Rep_reattendance probability Fullpay.sav'
  /DROP=revisit n cases reattend cumcases cumreatt /COMPRESSED.